﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Flow_GetDocumentInfo]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Flow_GetDocumentInfo];
GO
CREATE PROCEDURE [dbo].[sproc_Flow_GetDocumentInfo]
    @DocID int
AS
SELECT     a.doc_id,
    a.doc_added_date,
    a.doc_status,
    a.flow_id,
    a.step_id,
    c.staff_name,
    c.realname,
    d.flow_name,
    e.step_name,
    b.*
    FROM 
        uds_flow_document a,
        uds_flow_Style_Data b,
        uds_staff c,
        uds_flow d,
        uds_flow_step e        
    WHERE a.doc_id = b.doc_id 
      and c.staff_id = a.doc_builder_id
      and a.flow_id = d.flow_id
      and a.flow_id = e.flow_id
      and a.step_id = e.step_id
       and a.doc_id = @DocID